import { getStopwatchDetail } from '@/api/test/index';
import { stopwatchConfig } from '@/pages/CodeTables/specification';

const stopwatch = reactive<{
  detail: stopwatchConfig[];
  code: string;
  name: string;
  illustrate: string;
}>({
  detail: [],
  code: '',
  name: '',
  illustrate: '',
});

// 控制抽屉显示
const drawer = ref<boolean>(false);
// 控制弹窗显示
const dialog = ref<boolean>(false);
// 操作是新增还是编辑
const cuStatus = ref<number>();
const Detail = async () => {
  const res = await getStopwatchDetail(stopwatch.code);
  console.log(res);

  // const i = 1;
  // res.forEach((item: { [arg: string]: any }) => {
  //   item.id = i++;
  //   item.showStatus = false;
  // });
  console.log(res);
  stopwatch.detail = res as stopwatchConfig[];
};
export function getDetailHooks() {
  return {
    Detail,
    drawer,
    dialog,
    cuStatus,
    stopwatch,
  };
}
